<?php


namespace app\admin\validate;

class GoodsValidate extends BaseValidate
{
    protected $rule = [
        'name' => 'require',
        'type' => 'require|in:1,2',
        'price' => 'isFloatOrPositiveInteger',
        'market_price' => 'isFloatOrPositiveInteger',
        'category_id' => 'require|isPositiveInteger',
        'content' => 'require|isNotEmpty'
    ];

    protected $message = [
        'name.require' => '请输入名称',
        'type.require' => '请选择商品类型',
        'type.in' => '请选择商品类型',
        'price.isFloatOrPositiveInteger' => '价格必须是数字，且不能低于0',
        'market_price.isFloatOrPositiveInteger' => '市场价必须是数字，且不能低于0',
        'category_id.require' => '请选择分类',
        'category_id.isPositiveInteger' => '请选择分类',
        'content.require' => '请输入商品详情',
        'content.isNotEmpty' => '请输入商品详情',
    ];
}